#include<iostream>
void getMaxSum(int *line, int len, int &max, int &start, int &end)
{
    max = -1001;
    int ps=0, pe=0;
    int sum=0;
    while(pe<len)
    {
        sum+=line[pe];
        if(sum>max)
        {
            max=sum;
            start=ps;
            end=pe;
        }
        if(sum<0)
        {
            sum=0;
            ps=pe+1;
        }
        pe++;
    }
}
int main(int argc, char *argv[])
{
    int n,count,data[100000];
    std::cin>>n;
    for(int i = 0; i < n; i++)
    {
        std::cin>>count;
        for(int j = 0; j < count; j++)
            std::cin>>data[j];
        int max,start,end;
        getMaxSum(data, count, max, start, end);
        std::cout<<"Case "<<i+1<<":"<<std::endl;
        std::cout<<max<<" "<<start+1<<" "<<end+1<<std::endl;
        if(i!=n-1)
            std::cout<<std::endl;
    }
}
